﻿namespace WMS6.Web.TransportManagement
{
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class DeliveryOrderQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlBillingType;
        protected DropDownList ddlBillingTypeOper;
        protected DropDownList ddlCreateByOper;
        protected DropDownList ddlDeliveryOrderIDOper;
        protected DropDownList ddlDeliveryOrderType;
        protected DropDownList ddlDeliveryOrderTypeOper;
        protected DropDownList ddlDepartureOper;
        protected DropDownList ddlDestinationOper;
        protected DropDownList ddlExpressIDOper;
        protected DropDownList ddlExternOrderIDOper;
        protected DropDownList ddlOrderType;
        protected DropDownList ddlOrderTypeOper;
        protected DropDownList ddlPaymentType;
        protected DropDownList ddlPaymentTypeOper;
        protected DropDownList ddlPickupType;
        protected DropDownList ddlPickupTypeOper;
        protected DropDownList ddlStatus;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddlTransferType;
        protected DropDownList ddlTransferTypeOper;
        protected HtmlForm F8010;
        protected HtmlInputHidden hdnActionID;
        protected Label lblBillingType;
        protected Label lblBu;
        protected Label lblCreateBy;
        protected Label lblDeliveryOrderID;
        protected Label lblDeliveryOrderType;
        protected Label lblDeparture;
        protected Label lblDestination;
        protected Label lblExpressID;
        protected Label lblExternOrderID;
        protected Label lblOrderType;
        protected Label lblPaymentType;
        protected Label lblPickupType;
        protected Label lblStatus;
        protected Label lblTransferType;
        protected HtmlLink mycss;
        protected ScriptManager ScriptManager1;
        protected TextBox txtCreateBy;
        protected TextBox txtDeliveryOrderID;
        protected TextBox txtDeparture;
        protected TextBox txtDestination;
        protected TextBox txtExpressID;
        protected TextBox txtExternOrderID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DeliveryOrderList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("DeliveryOrderList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadDll()
        {
            base.BindData2DDLBySysCode(this.ddlDeliveryOrderType, "DeliveryType");
            this.ddlDeliveryOrderType.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlStatus, "DeliveryOrderStatus");
            this.ddlStatus.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlTransferType, "TransportMode");
            this.ddlTransferType.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlPickupType, "PickupType");
            this.ddlPickupType.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlPaymentType, "PaymentType");
            this.ddlPaymentType.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlBillingType, "BillingType");
            this.ddlBillingType.Items.Insert(0, new ListItem("-----", ""));
            base.BindData2DDLBySysCode(this.ddlOrderType, "DOC_TYPE");
            this.ddlOrderType.Items.Insert(0, new ListItem("-----", ""));
            base.InitQueryDDL(this.ddlDeliveryOrderIDOper, 0);
            base.InitQueryDDL(this.ddlExternOrderIDOper, 0);
            base.InitQueryDDL(this.ddlOrderTypeOper, 0);
            base.InitQueryDDL(this.ddlDeliveryOrderTypeOper, 0);
            base.InitQueryDDL(this.ddlExpressIDOper, 0);
            base.InitQueryDDL(this.ddlDepartureOper, 0);
            base.InitQueryDDL(this.ddlDestinationOper, 0);
            base.InitQueryDDL(this.ddlStatusOper, 0);
            base.InitQueryDDL(this.ddlTransferTypeOper, 0);
            base.InitQueryDDL(this.ddlPickupTypeOper, 0);
            base.InitQueryDDL(this.ddlPaymentTypeOper, 0);
            base.InitQueryDDL(this.ddlBillingTypeOper, 0);
            base.InitQueryDDL(this.ddlCreateByOper, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDll();
                if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
                {
                    this.btnExport.Visible = false;
                    this.btnNew.Visible = false;
                }
            }
        }

        public string BillingType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlBillingType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlBillingType.SelectedValue, this.ddlBillingTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string CreateBy
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtCreateBy.Text.Trim()))
                {
                    return base.GetParamsString(this.txtCreateBy.Text.Trim(), this.ddlCreateByOper.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryOrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeliveryOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeliveryOrderID.Text.Trim(), this.ddlDeliveryOrderIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryOrderType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlDeliveryOrderType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlDeliveryOrderType.SelectedValue, this.ddlDeliveryOrderTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string Departure
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeparture.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeparture.Text.Trim(), this.ddlDepartureOper.SelectedValue);
                }
                return "";
            }
        }

        public string Destination
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDestination.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDestination.Text.Trim(), this.ddlDestinationOper.SelectedValue);
                }
                return "";
            }
        }

        public string ExpressID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExpressID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExpressID.Text.Trim(), this.ddlExpressIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string ExternOrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternOrderID.Text.Trim(), this.ddlExternOrderIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string OrderType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlOrderType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlOrderType.SelectedValue, this.ddlOrderTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string PaymentType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlPaymentType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlPaymentType.SelectedValue, this.ddlPaymentTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string PickupType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlPickupType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlPickupType.SelectedValue, this.ddlPickupTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlStatus.SelectedValue))
                {
                    return base.GetParamsString(this.ddlStatus.SelectedValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }

        public string TransferType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.ddlTransferType.SelectedValue))
                {
                    return base.GetParamsString(this.ddlTransferType.SelectedValue, this.ddlTransferTypeOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

